Skip to content

[FwUpdateCfu] Fix broken PID/VID filtering in FwUpdateCfu::GetVersion method#64

Open
forderud wants to merge 1 commit into
microsoft:masterfrom
forderud:FwUpdateCfu-vid-filter-fix
Open

[FwUpdateCfu] Fix broken PID/VID filtering in FwUpdateCfu::GetVersion method#64
forderud wants to merge 1 commit into
microsoft:masterfrom
forderud:FwUpdateCfu-vid-filter-fix

Conversation

@forderud
Copy link
Copy Markdown

Fixes #63. I'm struggling to get FwUpdateCfu.exe version protocolCfgExample.cfg to work against the CfuVirtualHid driver in this repo.

The main problem appear to be faulty VID/PID filtering in the FwUpdateCfu::GetVersion method where the method looks for either a VID_xxxx&PID_yyyy or VID_xxxx substring in the DevicePath. The observed DevicePath for CfuVirtualHid on my test machine is \\?\HID#HID_DEVICE_SYSTEM_VHF#2&b84b253&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}, which doesn't contain the VID or PID.

The VID/PID filtering mechanism therefore appear to be flawed to me. I think the VID/PID filtering should instead be performed against a HIDD_ATTRIBUTES struct obtained through HidD_GetAttributes after opening the device.

… method

Fixes microsoft#63. I'm struggling to get FwUpdateCfu.exe version protocolCfgExample.cfg to work against the CfuVirtualHid driver in this repo.

The main problem appear to be faulty VID/PID filtering in the FwUpdateCfu::GetVersion method where the method looks for either a VID_xxxx&PID_yyyy or VID_xxxx substring in the DevicePath. The observed DevicePath for CfuVirtualHid on my test machine is \\?\HID#HID_DEVICE_SYSTEM_VHF#2&b84b253&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}, which doesn't contain the VID or PID.

The VID/PID filtering mechanism therefore appear to be flawed to me. I think the VID/PID filtering should instead be performed against a HIDD_ATTRIBUTES struct obtained through HidD_GetAttributes after opening the device.
forderud added a commit to forderud/CFU that referenced this pull request Sep 26, 2024
The FwUpdateCfu config file is currently unable to detect & query version for the virtual HID device (CfuVirtualHid) found in this repo. This PR seeks to fix this, so that the config file works out-of-the-box if used together with the PID/VID filtering fix in microsoft#64.

Changes to match the virtual HID device (CfuVirtualHid):
* Change PID to match virtual HID device.
* Change USAGEPAGE to match virtual HID device.
* Change USAGECOLLECTION to match virtual HID device.
* Changed VERSION_FEATURE_USAGE to match VERSIONS_FEATURE_USAGE in device.
forderud added a commit to forderud/CFU that referenced this pull request Sep 26, 2024
The FwUpdateCfu config file is currently unable to detect & query version for the virtual HID device (CfuVirtualHid) found in this repo. This PR seeks to fix this, so that the config file works out-of-the-box if used together with the PID/VID filtering fix in microsoft#64.

Changes to match virtual HID device (CfuVirtualHid) defines:
* Change PID to match PRODUCT_ID.
* Change USAGEPAGE to match CFU_DEVICE_USAGE_PAGE.
* Change USAGECOLLECTION to match CFU_DEVICE_USAGE.
* Change VERSION_FEATURE_USAGE to match VERSIONS_FEATURE_USAGE.
forderud added a commit to forderud/CFU that referenced this pull request Oct 1, 2024
The FwUpdateCfu config file is currently unable to detect & query version for the virtual HID device (CfuVirtualHid) found in this repo. This PR seeks to fix this, so that the config file works out-of-the-box if used together with the PID/VID filtering fix in microsoft#64.

Changes to match virtual HID device (CfuVirtualHid) defines:
* Change PID to match PRODUCT_ID.
* Change USAGEPAGE to match CFU_DEVICE_USAGE_PAGE.
* Change USAGECOLLECTION to match CFU_DEVICE_USAGE.
* Change VERSION_FEATURE_USAGE to match VERSIONS_FEATURE_USAGE.
forderud added a commit to forderud/CFU that referenced this pull request Oct 2, 2024
The FwUpdateCfu config file is currently unable to detect & query version for the virtual HID device (CfuVirtualHid) found in this repo. This PR seeks to fix this, so that the config file works out-of-the-box if used together with the PID/VID filtering fix in microsoft#64.

Changes to match virtual HID device (CfuVirtualHid) defines:
* Change PID to match PRODUCT_ID.
* Change USAGEPAGE to match CFU_DEVICE_USAGE_PAGE.
* Change USAGECOLLECTION to match CFU_DEVICE_USAGE.
* Change VERSION_FEATURE_USAGE to match VERSIONS_FEATURE_USAGE.
forderud added a commit to forderud/CFU that referenced this pull request Oct 2, 2024
The FwUpdateCfu config file is currently unable to detect & query version for the virtual HID device (CfuVirtualHid) found in this repo. This PR seeks to fix this, so that the config file works out-of-the-box if used together with the PID/VID filtering fix in microsoft#64.

Changes to match virtual HID device (CfuVirtualHid) defines:
* Change PID to match PRODUCT_ID.
* Change USAGEPAGE to match CFU_DEVICE_USAGE_PAGE.
* Change USAGECOLLECTION to match CFU_DEVICE_USAGE.
* Change VERSION_FEATURE_USAGE to match VERSIONS_FEATURE_USAGE.
forderud added a commit to forderud/CFU that referenced this pull request Oct 3, 2024
The FwUpdateCfu config file is currently unable to detect & query version for the virtual HID device (CfuVirtualHid) found in this repo. This PR seeks to fix this, so that the config file works out-of-the-box if used together with the PID/VID filtering fix in microsoft#64.

Changes to match CfuVirtualHid defines:
* Change PID to match PRODUCT_ID.
* Change USAGEPAGE to match CFU_DEVICE_USAGE_PAGE.
* Change USAGECOLLECTION to match CFU_DEVICE_USAGE.
* Change VERSION_FEATURE_USAGE to match VERSIONS_FEATURE_USAGE.
forderud added a commit to forderud/CFU that referenced this pull request Oct 3, 2024
The FwUpdateCfu config file is currently unable to detect & query version for the virtual HID device found in this repo (CfuVirtualHid). This PR seeks to fix this, so that the tool can at least query FW version. The PR require the PID/VID filtering fix in microsoft#64 to be merged first.

Impact to functionality:
* "FwUpdateCfu.exe version protocolCfgExample.cfg" is now able to successfully query FW version.
* "FwUpdateCfu.exe update protocolCfgExample.cfg CfuVirtualHidDevice_MCU.offer.bin CfuVirtualHidDevice_MCU.payload.bin" still fails (not a regression in this PR). This will need to be addressed later.

Changes to match defines in the CfuVirtualHid driver:
* Change PID to match PRODUCT_ID.
* Change USAGEPAGE to match CFU_DEVICE_USAGE_PAGE.
* Change USAGECOLLECTION to match CFU_DEVICE_USAGE.
* Change VERSION_FEATURE_USAGE to match VERSIONS_FEATURE_USAGE.
@forderud
Copy link
Copy Markdown
Author

forderud commented Oct 3, 2024

@samtertzakian @SurfaceDMFUser1 Not sure who to contact, so I'm reaching out to you as most active contributors to the repo. Would it be possible for one of you or other project maintainer to take a look at this and the other PR's I've submitted?

The reason for submitting PR's is that I want to asses CFU as FW upgrade mechanism for a custom HW project. I then first need the sample projects up&running, so that I have a working starting point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FwUpdateCfu] Broken PID/VID filtering in FwUpdateCfu::GetVersion method

1 participant